﻿using DevExpress.XtraEditors;
using DXApplicationTangche.UC.圣同润.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.圣同润.UC
{
    public partial class XtraUserControl商品分类一览 : DevExpress.XtraEditors.XtraUserControl
    {
        public XtraUserControl商品分类一览()
        {
            InitializeComponent();
        }
        public XtraUserControl商品分类一览(String category)
        {
            InitializeComponent();
            this.getData(category);
        }

        private void getData(String category)
        {
            ProductIndexDTO productIndexDTO = 圣同润Service.getProductIndexAll(category);
            for (int i = 0; i < productIndexDTO.productIndexMetaElementDTOS.Count; i++)
            {
                int index = i + 1;
                this.gridView商品分类一览.Columns.ColumnByName("gridColumn"+ index).Caption 
                    = productIndexDTO.productIndexMetaElementDTOS[i].caption;
                this.gridView商品分类一览.Columns.ColumnByName("gridColumn" + index).Visible 
                    = productIndexDTO.productIndexMetaElementDTOS[i].visible;
                this.gridView商品分类一览.Columns.ColumnByName("gridColumn" + index).FieldName 
                    = productIndexDTO.productIndexMetaElementDTOS[i].fieldName;
            }
            this.gridControl商品分类一览.DataSource = productIndexDTO.viewChanmamaProductClassInfoDaos;
            this.gridView商品分类一览.RefreshData();
        }
    }
}
